package com.project.taohaoCoupons.merchant.admin.config;

import io.swagger.v3.oas.models.OpenAPI;

import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Slf4j
@Configuration
public class SwaggerConfiguration implements ApplicationRunner {
    @Value("${server.port}")
    private int serverPort;
    @Bean
    public OpenAPI openAPI() {
        return new OpenAPI().info(new Info()
                        .title("淘好券-商家后台管理系统")
                        .description("创建优惠券、店家查看以及管理优惠券、创建优惠券发放批次等")
                        .version("v1.0.0")
                        .contact(new Contact().name("zhangyuxin").email("1875117028@qq.com"))
                );
    }
    @Override
    public void run(ApplicationArguments args) throws Exception {
        log.info("API Document: http://127.0.0.1:{}/doc.html", serverPort);
    }
}
